package com.autumn.platform.dao.schema.executor;

import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.transaction.Transaction;

public class ReuseExecutor extends org.apache.ibatis.executor.ReuseExecutor {

    public ReuseExecutor(Configuration configuration, Transaction transaction) {
        super(configuration, transaction);
    }

    @Override
    public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowBounds rowBounds, BoundSql boundSql) {
        if (isClosed()) {
            throw new ExecutorException("Executor was closed.");
        }
        return CacheKeyGenerator.createCacheKey(ms, parameterObject, rowBounds, boundSql);
    }
}
